
#include "stm32f0xx_hal.h"
#include "led.h"
#include "beep.h"

#define feedback(open) { if(open){ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_10, GPIO_PIN_RESET); } \
												 else    { HAL_GPIO_WritePin(GPIOA, GPIO_PIN_10, GPIO_PIN_SET); } }

typedef struct __PACKED _beep{
	uint8_t open;   			//蜂鸣器打开标志
	uint32_t open_time;   //蜂鸣器打开时间
	uint32_t old_time;
}beep;

typedef enum event_enum{
	EVENT_NONE = 0,
	EVENT_FALLING,
	EVENT_LOW,
	EVENT_RISING,
	EVENT_HIGH,
	EVENT_END
}EVENT_ENUM;

typedef struct __PACKED _extern_event{
	EVENT_ENUM flag;          //电平状态
	uint32_t continue_time;   //电平持续时间
	uint32_t low_old_time;
	uint32_t high_old_time;
}extern_event;

void system_init(void);
void app( void );
void open_beep(void);
void event_ipt(void);

extern beep beep1;
extern extern_event event;


